package demo.controller;

import demo.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class TestController {

//    //属性注入
//    @Autowired
//    private TestService testService;

//    //构造方法注入
//    private TestService testService;
//    @Autowired
//    public TestController(TestService testService){
//        this.testService = testService;
//    }
//    public TestController(){}

    //Setter注入
    private TestService testService;
    @Autowired
    public void setTestService(TestService testService){
        this.testService = testService;
    }

    public void say(){
        testService.say();
        System.out.println("hi");
    }
}
